<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class AdminRoleSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $datas = [
            [
                'name'       => '系统管理员',
                'slug'       => 'admin',
                'sort'       => 1,
                'memo'       => '系统最高权限的角色',
                'created_at' => date('Y-m-d H:i:s'),
                'updated_at' => date('Y-m-d H:i:s'),
            ],
            [
                'name'       => '权限管理员',
                'slug'       => 'permissionAdmin',
                'sort'       => 2,
                'memo'       => '分配系统权限',
                'created_at' => date('Y-m-d H:i:s'),
                'updated_at' => date('Y-m-d H:i:s'),
            ],
            [
                'name'       => '文章管理员',
                'slug'       => 'articleAdmin',
                'sort'       => 3,
                'memo'       => '文章模块的管理员',
                'created_at' => date('Y-m-d H:i:s'),
                'updated_at' => date('Y-m-d H:i:s'),
            ],
        ];
        DB::transaction(function () use ($datas) {
            foreach ($datas as $data) {
                DB::table('admin_roles')->insert($data);
            }
        });
    }
}
